package Main;

//
//["A","B","C","D","E","F"],[["C","F"],["C","D"],["E"],[""],[],[]]
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class TopuSort {
    static String[] cache = new String[10000];

    static Map<String,Integer> map = new HashMap<>();

    public static void main(String[] args) {
        readInput();
    }

    public static void readInput(){
        Scanner scanner = new Scanner(System.in);
        String input = scanner.nextLine();
        int index = 0;
        for (int i =0 ;i<input.length();i++){
            char c = input.charAt(i);
            if (c == ']'){
                index =i;
                break;
            }
        }

        String sub1 = input.substring(0,index+1);

        String sub2 = input.substring(index+2,input.length());

        for (int i=0;i<sub1.length();i++){
            char c = sub1.charAt(i);
            if (c>='A'&&c<='Z'){
                map.put(String.valueOf(c),0);
                cache[i] = String.valueOf(c);
            }
        }

        for (int i=0;i<sub2.length();i++){
            String[] sub3 = sub2.split("[,]");
            for (int j=0;j< sub3.length;j++){
                String sts = sub3[j];
                for (char d:sts.toCharArray()){
                    if (d>='A'&&d<='Z'){
                        int count = map.get(String.valueOf(d));
                        count++;
                        map.put(cache[j],count);
//                        System.out.println(cache[j]);
                    }
                }
            }
        }
        System.out.println(map);

    }
}
